#include<stdio.h>
int reverse(int x) {
    int rev = 0;
    while (x != 0) {
        if (rev < -2147483647/ 10 || rev >2147483647/ 10) {
            return 0;
        }
        int digit = x % 10;
        x /= 10;
        rev = rev * 10 + digit;
    }
    return rev;
}
int main(){
    int n;
  scanf("%d",&n);
  n=reverse(n);
  printf("%d\n",n);
  return 0;
}